package com.bw.service.impl;

import com.alibaba.fastjson.JSON;
import com.bw.entity.Book;
import com.bw.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
@Service
public class BookServiceImpl implements BookService {



    @Override
    public Integer addBook(Book book) {
        try {
            Thread.sleep(3 * 1000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        //  代码的可读性差， 代码变的臃肿
//        System.out.println("addBook  的入参是："  + JSON.toJSONString(book));
        System.out.println("-----addBook 正在执行---");
//        System.out.println("addBook  的返参是：1");
        return 1;
    }

    @Override
    public Integer updateBook(Book book) {
        System.out.println("-----updateBook 正在执行---");
        return 1;
    }

    @Override
    public List<Book> selectBook(String name) {


        return Arrays.asList(new Book());
    }
}
